import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { NestExpressApplication } from '@nestjs/platform-express';

async function bootstrap() {
  const app = await NestFactory.create<NestExpressApplication>(AppModule);
  // 创建Swagger选项
  const options = new DocumentBuilder()
    .setTitle('昊琰tv')
    .setDescription('api接口文档说明')
    .setVersion('1.0')
    .addTag('example')
    .build();

  app.useStaticAssets('statics');
  // 创建Swagger文档
  const document = SwaggerModule.createDocument(app, options);
  // 设置`/api`路由为Swagger文档及其UI的主页
  SwaggerModule.setup('/api/doc', app, document);
  await app.listen(3000);
}
bootstrap();
